from redis import StrictRedis


class Config:
    DEBUG = None
    #设置秘钥
    SECRET_KEY = 'e4SZaSeYdXzUhj7asaoFu/SMLibLRPDVi17NkOWTco5+/hC5rHKQfMBl3HenAuV4wU4='
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    #配置mysql数据库的链接信息
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info1'

    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    #配置状态保持中的session信息，存储在redis数据库中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)#session链接的redis数据库实例
    SESSION_USE_SIGNER = True#session签名
    PERMANENT_SESSION_LIFETIME=86400#session有效期

#实现开发模式下的配置信息
class DevelopmentConfig(Config):
    DEBUG = True

 #实现生产环境下的配置信息
class ProductionConfig(Config):
    DEBUG = False


config_dict = {
    'development':DevelopmentConfig,
    'production':ProductionConfig
}